home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / misc1 / iv26_w30.zip / INTERVIE / GRAPHIC / POLYGONS.H < prev    next >
C/C++ Source or Header  |  1991-12-10  |  4KB  |  123 lines

  1. /*
  2.  * Copyright (c) 1987, 1988, 1989 Stanford University
  3.  *
  4.  * Permission to use, copy, modify, distribute, and sell this software and its
  5.  * documentation for any purpose is hereby granted without fee, provided
  6.  * that the above copyright notice appear in all copies and that both that
  7.  * copyright notice and this permission notice appear in supporting
  8.  * documentation, and that the name of Stanford not be used in advertising or
  9.  * publicity pertaining to distribution of the software without specific,
  10.  * written prior permission.  Stanford makes no representations about
  11.  * the suitability of this software for any purpose.  It is provided "as is"
  12.  * without express or implied warranty.
  13.  *
  14.  * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  15.  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
  16.  * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  17.  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  18.  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  19.  * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
  20.  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  21.  */
  22.  
  23. /*
  24.  * Interface to Rects and Polygons, objects derived from Graphic.
  25.  */
  26.  
  27. #ifndef polygons_h
  28. #define polygons_h
  29.  
  30. #include <InterViews/Graphic/lines.h>
  31.  
  32. class Rect : public Graphic {
  33. public:
  34.     Rect();
  35.     Rect(Coord x0, Coord y0, Coord x1, Coord y1, Graphic* = nil);
  36.  
  37.     void GetOriginal(Coord&, Coord&, Coord&, Coord&);
  38.     virtual void SetBrush(PBrush*);
  39.     virtual PBrush* GetBrush();
  40.     virtual void SetPattern(PPattern*);
  41.     virtual PPattern* GetPattern();
  42.  
  43.     virtual ClassId GetClassId();
  44.     virtual boolean IsA(ClassId);
  45. protected:
  46.     virtual void getExtent(float&, float&, float&, float&, float&, Graphic*);
  47.     virtual boolean contains(PointObj&, Graphic*);
  48.     virtual boolean intersects(BoxObj&, Graphic*);
  49.     virtual void draw(Canvas*, Graphic*);
  50.  
  51.     virtual void pat(Ref);
  52.     virtual Ref pat();
  53.     virtual void br(Ref);
  54.     virtual Ref br();
  55.  
  56.     virtual Graphic* Copy();
  57.     virtual boolean read(PFile*);
  58.     virtual boolean write(PFile*);
  59. protected:
  60.     Coord x0, y0, x1, y1;
  61.     Ref _patbr;
  62. };
  63.  
  64. class GFillRect : public Rect {
  65. public:
  66.     GFillRect();
  67.     GFillRect(Coord x0, Coord y0, Coord x1, Coord y1, Graphic* = nil);
  68.  
  69.     virtual void SetBrush(PBrush*);
  70.  
  71.     virtual Graphic* Copy();
  72.     virtual ClassId GetClassId();
  73.     virtual boolean IsA(ClassId);
  74. protected:
  75.     virtual void getExtent(float&, float&, float&, float&, float&, Graphic*);
  76.     virtual boolean contains(PointObj&, Graphic*);
  77.     virtual boolean intersects(BoxObj&, Graphic*);
  78.     virtual void draw(Canvas*, Graphic*);
  79.  
  80.     virtual void pat(Ref);
  81.     virtual Ref pat();
  82.     virtual void br(Ref);
  83.     virtual Ref br();
  84. };
  85.  
  86. class GPolygon : public MultiLine {
  87. public:
  88.     GPolygon();
  89.     GPolygon(Coord* x, Coord* y, int count, Graphic* = nil);
  90.  
  91.     virtual Graphic* Copy();
  92.     virtual ClassId GetClassId();
  93.     virtual boolean IsA(ClassId);
  94. protected:
  95.     virtual boolean contains(PointObj&, Graphic*);
  96.     virtual boolean intersects(BoxObj&, Graphic*);
  97.     virtual void draw(Canvas*, Graphic*);
  98. };
  99.  
  100. class FillPolygon : public GPolygon {
  101. public:
  102.     FillPolygon();
  103.     FillPolygon(Coord* x, Coord* y, int count, Graphic* = nil);
  104.  
  105.     virtual void SetBrush(PBrush*);
  106.  
  107.     virtual Graphic* Copy();
  108.     virtual ClassId GetClassId();
  109.     virtual boolean IsA(ClassId);
  110. protected:
  111.     virtual void getExtent(float&, float&, float&, float&, float&, Graphic*);
  112.     virtual boolean contains(PointObj&, Graphic*);
  113.     virtual boolean intersects(BoxObj&, Graphic*);
  114.     virtual void draw(Canvas*, Graphic*);
  115.  
  116.     virtual void pat(Ref);
  117.     virtual Ref pat();
  118.     virtual void br(Ref);
  119.     virtual Ref br();
  120. };
  121.  
  122. #endif
  123.